import com.xeiam.xchart.BitmapEncoder;
import com.xeiam.xchart.Chart;
import com.xeiam.xchart.Series;
import com.xeiam.xchart.SeriesLineStyle;
import com.xeiam.xchart.SeriesMarker;
import com.xeiam.xchart.StyleManager.LegendPosition;
import com.xeiam.xchart.SwingWrapper;
import java.awt.Color;
 
/**
 * Creates a simple Chart using QuickChart
 */
public class Example01 {
 
  public static void main(String[] args) throws Exception {
 
      Chart chart = new Chart(800, 600);
       
      // Customize Chart
      chart.setChartTitle("TITLE - EXAMPLE");
      chart.setXAxisTitle("Elementos por lista : 1 = 10 | 2 = 100 | 3 = 1000 |  4 = 10000");
      chart.setYAxisTitle("Time - MilliSeconds");
      chart.getStyleManager().setLegendBackgroundColor(Color.PINK);
      chart.getStyleManager().setLegendPosition(LegendPosition.OutsideE);
       
      double[] xData = new double[] { 1, 2, 3, 4 };
      double[] yData = new double[] { 1, 1.2, 2.3, 3 };
      double[] yData2 = new double[] { 1.2, 1, 2, 2.8 };
       
      Series series = chart.addSeries("Previsão Teórica", xData, yData);
      series.setLineStyle(SeriesLineStyle.NONE);
      series.setMarker(SeriesMarker.DIAMOND);
      series.setMarkerColor(Color.BLUE);
       
      Series series2 = chart.addSeries("Linha Experimental", xData, yData2);

      series2.setMarker(SeriesMarker.NONE);
      series2.setLineStyle(SeriesLineStyle.DASH_DASH);
      series2.setLineColor(Color.RED);
       
      chart.getStyleManager().setPlotPadding(20);
       
      chart.getStyleManager().setYAxisMin(1);
      chart.getStyleManager().setYAxisMax(3);
       
      chart.getStyleManager().setXAxisMin(1);
      chart.getStyleManager().setXAxisMax(4);
      
      chart.getStyleManager().setLegendBackgroundColor(Color.PINK);
    // Show it
    new SwingWrapper(chart).displayChart();
 
    // Save it
    BitmapEncoder.savePNG(chart, "./Sample_Chart.png");
 
  }
}